<script setup lang="ts">
import { ref } from 'vue'
import { Table } from '@arco-design/web-vue'

const aTableRef = ref<InstanceType<typeof Table>>()
const scroll = ref({
    y: '100%'
})

const selectAll = aTableRef.value?.selectAll // 设置全选状态
const select = aTableRef.value?.select // 设置行选择器状态
const expandAll = aTableRef.value?.expandAll // 设置全部展开状态
const expand = aTableRef.value?.expand // 设置展开状态
const resetFilters = aTableRef.value?.resetFilters // 重置列的筛选器
const clearFilters = aTableRef.value?.clearFilters // 清空列的筛选器
const resetSorters = aTableRef.value?.resetSorters // 重置列的排序
const clearSorters = aTableRef.value?.clearSorters // 清空列的排序

defineExpose({
    selectAll,
    select,
    expandAll,
    expand,
    resetFilters,
    clearFilters,
    resetSorters,
    clearSorters
})
</script>

<template>
    <a-table
        ref="aTableRef"
        v-bind="$attrs"
        :bordered="{ cell: true }"
        :scroll="scroll"
        table-layout-fixed
        :pagination="false"
        size="small"
        class="page-table"
    >
        <template v-for="(_val, name) in $slots" #[name]="slotData">
            <slot :name="name" v-bind="slotData || {}" />
        </template>
    </a-table>
</template>
